package com.zhs.gccs.activity.gb;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.zhs.gccs.R;
import com.zhs.gccs.base.BaseActivity;
import com.zhs.gccs.utils.OnNoDoubleClickListener;
import com.zhs.gccs.view.SimpleWebView;

import butterknife.BindView;
import butterknife.ButterKnife;

public class OnlineFilePreviewActivity extends BaseActivity   {
    public static String intent_title = "title";
    public static String intent_url = "url";
    private String title;
    private String url;

    @BindView(R.id.iv_back)
    View iv_back;
    @BindView(R.id.tv_title)
    TextView tv_title;
    @BindView(R.id.simpleWebView)
    SimpleWebView simpleWebView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_webview);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        ButterKnife.bind(this);
        iv_back.setOnClickListener(new OnNoDoubleClickListener() {
            @Override
            protected void onNoDoubleClick(View v) {
                finish();
            }
        });
        title = getIntent().getStringExtra(intent_title);
        url = getIntent().getStringExtra(intent_url);
        tv_title.setText(title);
        if(!TextUtils.isEmpty(url)){
            simpleWebView.getSetting().setTextZoom(280);
            simpleWebView.loadUrl(url);
        }
    }
}
